package com.jy.adscm.operation.mscyb.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.jy.adscm.bean.system.JyUser;
import com.jy.adscm.operation.mscyb.bean.JqylMaterialinfo;
import com.jy.adscm.operation.mscyb.bean.JqzzMachineinfo;
import com.jy.adscm.operation.mscyb.mapper.mysql.JqzzMachineinfoMapper;
import com.jy.adscm.operation.mscyb.service.JqzzMachineinfoService;
import com.jy.adscm.system.mapper.mysql.JyUserMapper;
import com.jy.adscm.utils.AdscmBaseUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zyl
 * @since 2018-12-04
 */
@Service
public class JqzzMachineinfoServiceImpl extends ServiceImpl<JqzzMachineinfoMapper, JqzzMachineinfo> implements JqzzMachineinfoService {
     @Autowired
    JyUserMapper jyUserMapper;
    @Override
    public List<JqzzMachineinfo> selectByTid(String tid) {
        Wrapper<JqzzMachineinfo> wrapper =new EntityWrapper<>();
        wrapper.eq("TID",tid);
        List<JqzzMachineinfo> JqzzMachineinfos = super.selectList(wrapper);
        for (JqzzMachineinfo jqzzMachineinfo : JqzzMachineinfos) {
            if (AdscmBaseUtils.getInstance().isNotEmpty(jqzzMachineinfo.getPerson(),null)){
                JyUser jyUser = jyUserMapper.selectById(jqzzMachineinfo.getPerson());
                jqzzMachineinfo.setPersonName(jyUser.getName());
            }
        }
        return JqzzMachineinfos;
    }

}
